package ink.unit;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.Random;

/**
 * @author wangzhuangzhuang
 * @DESC: BigInteger最大范围64位long型整数。使用long型整数
 * 可以直接通过CPU指令计算
 * @date 2022-01-25 12:58
 */
public class Demo02 {
	public static void main(String[] args) {
		BigInteger bi = new BigInteger("999999").pow(99);
		float v = bi.floatValue();
		System.out.println("v: " + v); // v: Infinity
		BigDecimal bd = new BigDecimal("123.4567");
		System.out.println(bd.multiply(bd)); // 15241.55677489

		BigDecimal d01 = new BigDecimal("123.45");
		BigDecimal d02 = new BigDecimal("123.4500");
		BigDecimal d03 = new BigDecimal("1234500");
		System.out.println(d01.scale()); // 2, 两位小数
		System.out.println(d02.scale()); // 4
		System.out.println(d03.scale()); // 0

		BigDecimal num01 = new BigDecimal("123.456789");
		BigDecimal num02 = num01.setScale(4, RoundingMode.HALF_UP);
		BigDecimal num03 = num01.setScale(4, RoundingMode.DOWN);
		System.out.println("num01: " + num01 + " num02: " + num02 + " num03: " + num03);
		// num01: 123.456789 num02: 123.4568 num03: 123.4567

		BigDecimal bd01 = new BigDecimal("123.456");
		BigDecimal bd02 = new BigDecimal("123.45600");
		BigDecimal[] dr = bd01.divideAndRemainder(bd02);
		if(dr[1].signum() == 0){

		}

		int abs = Math.abs(-100);
		double abs1 = Math.abs(-7.8);

		Random random = new Random();
		int i = random.nextInt();
		System.out.println("i: " + i);
		int i1 = random.nextInt(10);
	}

}